<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>终极项目</title>
		<script type="text/javascript" src="../js/jquery-1.8.3.js"></script>
		<script type="text/javascript" src="../js/easyui/jquery.easyui.min.js"></script>
		<script type="text/javascript" src="../js/easyui/locale/easyui-lang-zh_CN.js"></script>
		<link rel="stylesheet" href="../js/easyui/themes/default/easyui.css" />
		<link rel="stylesheet" href="../js/easyui/themes/icon.css" />
		<!-- 引入ztree -->
		<script src="../js/ztree/jquery.ztree.all-3.5.js" type="text/javascript" charset="utf-8"></script>
		<link rel="stylesheet" type="text/css" href="../js/ztree/zTreeStyle.css" />
		<script type="text/javascript">
			$(function() {
				var setting = {
					data: {
						//设置可以使用简单Json数据
						simpleData: {
							enable: true
						}
					},
					//在setting中设置回调函数，用来响应点击事件
					callback: {
						onClick: function(event, treeId, treeNode, clickFlag) {
							var content = '<div style="width:100%;height:100%;overflow:hidden;">'                              +'<iframe src="' 
							+ treeNode.page 
							+ '"scrolling="auto" style="width:100%;height:100%;border:0;" /></div>'

							if(treeNode.page != undefined && treeNode.page != "") {
								if($("#mytabs").tabs('exists', treeNode.name)) {
									$("#mytabs").tabs('select', treeNode.name);
								} else {
									$("#mytabs").tabs('add', {
										title: treeNode.name,
										content: content,
										closable: true
									});
								}
							}
						}
					}
				};
				var zNodes = [{
						id: 1,
						pId: 0,
						name: "父节点一"
					},
					{
						id: 11,
						pId: 1,
						name: "子节点1"
					},
					{
						id: 12,
						pId: 1,
						name: "子节点2"
					},
					{
						id: 2,
						pId: 0,
						name: "父节点二"
					},
					{
						id: 21,
						pId: 2,
						name: "子节点1"
					},
					{
						id: 22,
						pId: 2,
						name: "百度",
						page: "https://www.baidu.com"
					}
				];
				// 3、生成菜单
				$.fn.zTree.init($("#baseMenu"), setting, zNodes);
				//对链接绑定点击事件
				/*$("#baidu").click(function() {
					//添加一个新的选项卡
					$("#mytabs").tabs('add', {
						title: '百度',
						content: '百度一下，你就傻逼'
					});
				});*/
			//对选项卡注册 右键事件
			$("#mytabs").tabs({
				onContextMenu:function(e,title,index){
					//阻止默认菜单显示
					e.preventDefault();
					$("#mm").menu('show',{
						left:e.pageX,
						top:e.pageY
					});
				}
			});
			});
		</script>
		<script type="text/javascript">
			$(function(){
				$.messager.show({
					title:"沈**",
					msg:"<a href='#'>点击这里哈哈哈哈</a>",
					timeout:5000
				});
			});
		</script>
	</head>

	<body class="easyui-layout">
		
		<div data-options="region:'north',title:'传智播客管理系统'" style="height: 100px;">
			
			<a href="#" class="easyui-menubutton" data-options="iconCls:'icon-save',menu:'#mm1'">
			菜单系统
		</a>
		</div>
		<div data-options="region:'west'" style="width: 180px;">

			<div class="easyui-accordion" data-options="fit:true">
				<div data-options="title:'基础菜单'">
					<ul id="baseMenu" class="ztree"></ul>

				</div>
				<div data-options="title:'系统菜单'">面板二</div>
			</div>
		</div>
		<div data-options="region:'center'">
			<!--选项卡面板 -->
			<div id="mytabs" class="easyui-tabs" ,data-options="fit:true">
				<div data-options="title:'选项面板',closable:true">选项卡面板</div>
			</div>
		</div>
		<div data-option="region:'east'" style="width: 80px;">东部区域</div>
		<div data-options="region:'south'" style="height: 80px;">南部区域</div>
		<!---->
		<!--菜单，初始化时自动隐藏-->
		<div id="mm" class="easyui-menu" style="width:120px;">
			<div>关闭当前窗口</div>
			<div>关闭其他窗口</div>
			<div class="menu-sep"></div><!--分割线-->
			<div data-options="iconCls:'icon-cancel'">关闭所有窗口</div>
		</div>
	</body>
       <div id="mm1" style="width:120px;">
       	<div>菜单一</div>
       	<div>菜单二</div>
       	<div>菜单三</div>
       	<div class="menu-sep"></div>
       	<div>菜单四</div>
       </div>
</html>